@echo off

setlocal enabledelayedexpansion

set OUTDIR=%~dp0%

echo outdir %~dp0


for /F "delims=\ tokens=1,2,3,4,5,6,7,8,9,10,11,12" %%a in ("%OUTDIR%") do (
    if %%a==project_GG_Slave (set PROJECT_NAME=%%b)
    if %%b==project_GG_Slave (set PROJECT_NAME=%%c)
    if %%c==project_GG_Slave (set PROJECT_NAME=%%d)
    if %%d==project_GG_Slave (set PROJECT_NAME=%%e)
    if %%e==project_GG_Slave (set PROJECT_NAME=%%f)
    if %%f==project_GG_Slave (set PROJECT_NAME=%%g)
    if %%g==project_GG_Slave (set PROJECT_NAME=%%h)
    if %%h==project_GG_Slave (set PROJECT_NAME=%%i)
    if %%i==project_GG_Slave (set PROJECT_NAME=%%j)
    if %%j==project_GG_Slave (set PROJECT_NAME=%%k)
    if %%k==project_GG_Slave (set PROJECT_NAME=%%l)
)

set name=_iocfg.h
set IOCFG_H=%PROJECT_NAME%%name%
echo %IOCFG_H%



echo #define IOCFG_H        "%IOCFG_H%" >> %OUTDIR%..\..\include_slave\buildinfo\build_info.h
